--创建外部表
create external table if not exists dongfeng.navinfo_stage_d007 (
        latitude                                          INT                 COMMENT '纬度',
        longitude                                         INT                 COMMENT '经度',
        originalLat                                       INT                 COMMENT '原始纬度',
        originalLng                                       INT                 COMMENT '原始经度',
        height                                            INT                 COMMENT '高程',
        direction                                         INT                 COMMENT '方向',
        gpsDate                                           BIGINT              COMMENT '时间',
        accelerator                                       STRING              COMMENT '油门踏板开度',
        driverRequestEngineMode                           INT                 COMMENT '驾驶员请求发动机模式',
        rotation                                          STRING              COMMENT '发动机转速',
        engineOutputTorque                                INT                 COMMENT '发动机输出扭矩',
        transmissionOutputShaftRotation                   STRING              COMMENT '变速箱输出轴转速',
        clutchSlipRatio                                   STRING              COMMENT '离合器滑移率',
        transmissionInputShaftRotation                    STRING              COMMENT '变速箱输入轴转速',
        transmissionSystemCombinedState                   INT                 COMMENT '传动系统结合状态',
        gear                                              INT                 COMMENT '当前挡位',
        gearboxMode1                                      INT                 COMMENT '变速箱模式1',
        gearboxMode2                                      INT                 COMMENT '变速箱模式2',
        gearboxMode3                                      INT                 COMMENT '变速箱模式3',
        gearboxMode4                                      INT                 COMMENT '变速箱模式4',
        gearboxRequestGear                                INT                 COMMENT '变速箱请求档位',
        speed                                             STRING              COMMENT '车速',
        totalMileage                                      BIGINT              COMMENT '总里程',
        exhaustBrakingState                               INT                 COMMENT '排气制动状态',
        fuelConsumption                                   STRING              COMMENT '燃油消耗率',
        instantaneousFuelConsumption                      STRING              COMMENT '瞬时油耗',
        averageFuelConsumption                            STRING              COMMENT '平均油耗',
        temporaryManualRequest                            INT                 COMMENT '临时手动请求',
        brake                                             INT                 COMMENT '制动开关',
        cruiseActivation                                  INT                 COMMENT '巡航激活',
        parkingBrake                                      INT                 COMMENT '驻车制动',
        leftFrontWheelRotation                            STRING              COMMENT '左前轮转速',
        rightFrontWheelRotation                           STRING              COMMENT '右前轮转速',
        ABSActivation                                     INT                 COMMENT 'ABS激活',
        rampStartSwitch                                   INT                 COMMENT '坡道起步开关',
        atmosphericPressure1                              STRING              COMMENT '大气压力1',
        atmosphericTemperature                            STRING              COMMENT '大气温度',
        airPressure                                       STRING              COMMENT '气压',
        quality                                           STRING              COMMENT '质量',
        ramp                                              INT                 COMMENT '坡道',
        transmissionOilTemperature                        STRING              COMMENT '变速箱油温',
        clutchOffset                                      STRING              COMMENT '离合器偏移量',
        clutchWearPercentage                              INT                 COMMENT '离合器磨损百分比',
        clutchTemperature                                 INT                 COMMENT '离合器温度',
        clutchNipPoint                                    STRING              COMMENT '离合器咬合点',
        terminalId                                        BIGINT              COMMENT '终端号',
        part_time                                         INT                 COMMENT '分区时间'
) row format delimited fields terminated by '\001' STORED AS TEXTFILE location '/user/data/dongfeng/stage_import_d007';

--创建目标表
create table if not exists dongfeng.navinfo_parquet_d007(
        latitude                                          INT                 COMMENT '纬度',
        longitude                                         INT                 COMMENT '经度',
        originalLat                                       INT                 COMMENT '原始纬度',
        originalLng                                       INT                 COMMENT '原始经度',
        height                                            INT                 COMMENT '高程',
        direction                                         INT                 COMMENT '方向',
        gpsDate                                           BIGINT              COMMENT '时间',
        accelerator                                       STRING              COMMENT '油门踏板开度',
        driverRequestEngineMode                           INT                 COMMENT '驾驶员请求发动机模式',
        rotation                                          STRING              COMMENT '发动机转速',
        engineOutputTorque                                INT                 COMMENT '发动机输出扭矩',
        transmissionOutputShaftRotation                   STRING              COMMENT '变速箱输出轴转速',
        clutchSlipRatio                                   STRING              COMMENT '离合器滑移率',
        transmissionInputShaftRotation                    STRING              COMMENT '变速箱输入轴转速',
        transmissionSystemCombinedState                   INT                 COMMENT '传动系统结合状态',
        gear                                              INT                 COMMENT '当前挡位',
        gearboxMode1                                      INT                 COMMENT '变速箱模式1',
        gearboxMode2                                      INT                 COMMENT '变速箱模式2',
        gearboxMode3                                      INT                 COMMENT '变速箱模式3',
        gearboxMode4                                      INT                 COMMENT '变速箱模式4',
        gearboxRequestGear                                INT                 COMMENT '变速箱请求档位',
        speed                                             STRING              COMMENT '车速',
        totalMileage                                      BIGINT              COMMENT '总里程',
        exhaustBrakingState                               INT                 COMMENT '排气制动状态',
        fuelConsumption                                   STRING              COMMENT '燃油消耗率',
        instantaneousFuelConsumption                      STRING              COMMENT '瞬时油耗',
        averageFuelConsumption                            STRING              COMMENT '平均油耗',
        temporaryManualRequest                            INT                 COMMENT '临时手动请求',
        brake                                             INT                 COMMENT '制动开关',
        cruiseActivation                                  INT                 COMMENT '巡航激活',
        parkingBrake                                      INT                 COMMENT '驻车制动',
        leftFrontWheelRotation                            STRING              COMMENT '左前轮转速',
        rightFrontWheelRotation                           STRING              COMMENT '右前轮转速',
        ABSActivation                                     INT                 COMMENT 'ABS激活',
        rampStartSwitch                                   INT                 COMMENT '坡道起步开关',
        atmosphericPressure1                              STRING              COMMENT '大气压力1',
        atmosphericTemperature                            STRING              COMMENT '大气温度',
        airPressure                                       STRING              COMMENT '气压',
        quality                                           STRING              COMMENT '质量',
        ramp                                              INT                 COMMENT '坡道',
        transmissionOilTemperature                        STRING              COMMENT '变速箱油温',
        clutchOffset                                      STRING              COMMENT '离合器偏移量',
        clutchWearPercentage                              INT                 COMMENT '离合器磨损百分比',
        clutchTemperature                                 INT                 COMMENT '离合器温度',
        clutchNipPoint                                    STRING              COMMENT '离合器咬合点',
        terminalId                                        BIGINT              COMMENT '终端号',
        create_time                                       STRING              COMMENT '数据创建时间'
) partitioned by (part_time int) stored as Parquet TBLPROPERTIES('parquet.compression'='SNAPPY');
